home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 7.8 KB | 282 lines | [TEXT/MPS ] |
- ;
- ; File: CursorDevices.a
- ;
- ; Contains: Cursor Devices (mouse/trackball/etc) Interfaces.
- ;
- ; Version: Technology: System 7.5
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__CURSORDEVICES__') = 'UNDEFINED' THEN
- __CURSORDEVICES__ SET 1
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
- include 'MixedMode.a'
- ENDIF
- ;
- ; * * * W A R N I N G * * *
- ;
- ; On currently shipping PowerMacs, the CursorDevices manager is implemented
- ; in 68K code and emulated. Unfortunately, the MixedMode glue in InterfaceLib
- ; is incorrect. It and the 1.0 version of this file had incorrect parameter
- ; lists for most functions.
- ;
- ; As a first step to avoid runtime errors, the functions in this file were
- ; renamed (e.g. from"CrsrDevButtons" to "CursorDeviceButtons"). This will result
- ; in a link time error if a PowerPC application tries to call the functions.
- ; When InterfaceLib is fixed, the new names will be exported and PowerPC
- ; code will then be able to call them.
- ;
- ;
- IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
- ; typedef short ButtonOpcode
-
- ; ButtonOpcodes
-
- kButtonNoOp EQU 0 ; No action for this button
- kButtonSingleClick EQU 1 ; Normal mouse button
- kButtonDoubleClick EQU 2 ; Click-release-click when pressed
- kButtonClickLock EQU 3 ; Click on press, release on next press
-
- kButtonCustom EQU 6 ; Custom behavior, data = CursorDeviceCustomButtonUPP
- ; Device Classes
-
- kDeviceClassAbsolute EQU 0 ; a flat-response device
- kDeviceClassMouse EQU 1 ; mechanical or optical mouse
- kDeviceClassTrackball EQU 2 ; trackball
-
- kDeviceClass3D EQU 6 ; a 3D pointing device
- ; Structures used in Cursor Device Manager calls
- CursorData RECORD 0
- nextCursorData ds.l 1 ; offset: $0 (0) ; next in global list
- displayInfo ds.l 1 ; offset: $4 (4) ; unused (reserved for future)
- whereX ds.l 1 ; offset: $8 (8) ; horizontal position
- whereY ds.l 1 ; offset: $C (12) ; vertical position
- where ds Point ; offset: $10 (16) ; the pixel position
- isAbs ds.b 1 ; offset: $14 (20) ; has been stuffed with absolute coords
- buttonCount ds.b 1 ; offset: $15 (21) ; number of buttons currently pressed
- screenRes ds.l 1 ; offset: $16 (22) ; pixels per inch on the current display
- privateFields ds.w 22 ; offset: $1A (26) ; fields use internally by CDM
- sizeof EQU * ; size: $46 (70)
- ENDR
- ; typedef struct CursorData * CursorDataPtr
-
- CursorDevice RECORD 0
- nextCursorDevice ds.l 1 ; offset: $0 (0) ; pointer to next record in linked list
- whichCursor ds.l 1 ; offset: $4 (4) ; pointer to data for target cursor
- refCon ds.l 1 ; offset: $8 (8) ; application-defined
- unused ds.l 1 ; offset: $C (12) ; reserved for future
- devID ds.l 1 ; offset: $10 (16) ; device identifier (from ADB reg 1)
- resolution ds.l 1 ; offset: $14 (20) ; units/inch (orig. from ADB reg 1)
- devClass ds.b 1 ; offset: $18 (24) ; device class (from ADB reg 1)
- cntButtons ds.b 1 ; offset: $19 (25) ; number of buttons (from ADB reg 1)
- filler1 ds.b 1 ; offset: $1A (26) ; reserved for future
- buttons ds.b 1 ; offset: $1B (27) ; state of all buttons
- buttonOp ds.b 8 ; offset: $1C (28) ; action performed per button
- buttonTicks ds.l 8 ; offset: $24 (36) ; ticks when button last went up (for debounce)
- buttonData ds.l 8 ; offset: $44 (68) ; data for the button operation
- doubleClickTime ds.l 1 ; offset: $64 (100) ; device-specific double click speed
- acceleration ds.l 1 ; offset: $68 (104) ; current acceleration
- privateFields ds.w 15 ; offset: $6C (108) ; fields used internally to CDM
- sizeof EQU * ; size: $8A (138)
- ENDR
- ; typedef struct CursorDevice * CursorDevicePtr
-
- ; for use with CursorDeviceButtonOp when opcode = kButtonCustom
- ;
- ; pascal OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceMove
- moveq #0,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceMove
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceMoveTo
- moveq #1,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceMoveTo
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceFlush
- moveq #2,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceFlush
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceButtons
- moveq #3,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceButtons
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceButtonDown
- moveq #4,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceButtonDown
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceButtonUp
- moveq #5,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceButtonUp
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceButtonOp
- moveq #6,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceButtonOp
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceSetButtons
- moveq #7,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceSetButtons
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceSetAcceleration
- moveq #8,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceSetAcceleration
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceDoubleTime
- moveq #9,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceDoubleTime
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceUnitsPerInch
- moveq #10,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceUnitsPerInch
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceNextDevice
- moveq #11,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceNextDevice
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceNewDevice
- moveq #12,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceNewDevice
- ENDIF
-
- ;
- ; pascal OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
- ;
- IF ¬ GENERATINGCFM THEN
- Macro
- _CursorDeviceDisposeDevice
- moveq #13,D0
- dc.w $AADB
- EndM
- ELSE
- IMPORT_CFM_FUNCTION CursorDeviceDisposeDevice
- ENDIF
-
- ENDIF
- ENDIF ; __CURSORDEVICES__
-
-